import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    USER: 2, //1托运人 shipper, 2承运人 carrier
    token: '',
  },
  mutations: {
    // 登录
    loginX(state, object) {
      state.token = object.token;
      localStorage.setItem("token", object.token);
      localStorage.setItem("name", object.name);
      localStorage.setItem("phone", object.phone);
    },
    // 退出
    signoutX(state, token) {
      state.token = token;
      localStorage.setItem("token", "");
    }
  },
  actions: {},
  modules: {}
});